/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.aptech.sBean;

import com.aptech.entities.TblManager;
import java.util.List;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.Query;

/**
 *
 * @author Winner
 */
@Stateless
public class TblManagerFacade extends AbstractFacade<TblManager> {

    @PersistenceContext(unitName = "Elevation_System_Online-ejbPU")
    private EntityManager em;

    @Override
    protected EntityManager getEntityManager() {
        return em;
    }

    public TblManagerFacade() {
        super(TblManager.class);
    }

    public List<TblManager> checkLogin(String mnUserName, String mnPassword) {
        Query query = em.createNamedQuery("TblManager.checkLogin");
        query.setParameter("mnUserName", mnUserName);
        query.setParameter("mnPassword", mnPassword);
        return query.getResultList();
    }

    public List<TblManager> ViewStaffProject(int mnPermission) {
        Query query = em.createNamedQuery("TblManager.findByMnPermission");
        query.setParameter("mnPermission", mnPermission);
        return query.getResultList();
    }
    
    public List<TblManager> getManagerByID(int mnID) {
        Query query = em.createNamedQuery("TblManager.findByMnID");
        query.setParameter("mnID", mnID);
        return query.getResultList();
    }
}
